package com.kethink;

/**
 * @Description create by xuxiaojun
 * date: 2019/1/8
 * Time: 11:29
 */
public class LeeCode_357 {
    public static int countNumbersWithUniqueDigits(int n) {

        if(n == 0){
            return 1;
        }
        if(n == 1){
            return 10;
        }
        if(n >= 2){
            return countNumbersWithUniqueDigits(n-1) + test(n);
        }else {
            return -1;
        }
    }

    public static int test (int a){
        int i = 1;
        int result = 1;
        while (i < a){
            result *=  (10-i);
            i++;
        }
        return 9*result;
    }

    public static void main(String[] args){
        int n = 4;
        //4
        System.out.println(countNumbersWithUniqueDigits(n));
    }
}
